// @Package carbon
// @Description a simple, semantic and developer-friendly time package for golang
// @Page github.com/dromara/carbon
// @Developer gouguoyin
// @Blog www.gouguoyin.com
// @Email 245629560@qq.com

// Package carbon is a simple, semantic and developer-friendly time package for golang.
package 时间类

import (
	"time"
)

type Gosdk时间 = time.Time
type X星期 = time.Weekday
type X时区 = time.Location
type X时长 = time.Duration

// Carbon defines a Carbon struct.
// 定义 Carbon 结构体
type Carbon struct {
	layout       string
	time         Gosdk时间
	weekStartsAt X星期
	weekendDays  []X星期
	loc          *X时区
	lang         *X语言
	X错误          error
}

// NewCarbon returns a new Carbon instance.
// 返回 Carbon 实例
func X创建(时间 ...Gosdk时间) *Carbon {
	c := new(Carbon)
	c.lang = X创建语言().X设置区域(DefaultLocale)
	c.layout = DefaultLayout
	c.weekStartsAt = DefaultWeekStartsAt
	c.weekendDays = DefaultWeekendDays
	if len(时间) > 0 {
		c.time = 时间[0]
		c.loc = c.time.Location()
		return c
	}
	c.loc, c.X错误 = parseTimezone(DefaultTimezone)
	return c
}

// Copy returns a new copy of the current Carbon instance
// 复制 Carbon 实例
func (c *Carbon) X取副本() *Carbon {
	if c == nil {
		return nil
	}
	return &Carbon{
		layout:       c.layout,
		time:         time.Date(c.X取年(), time.Month(c.X取月()), c.X取日(), c.X取小时(), c.X取分钟(), c.X取秒(), c.X取纳秒(), c.loc),
		weekStartsAt: c.weekStartsAt,
		weekendDays:  c.weekendDays,
		loc:          c.loc,
		lang:         c.lang.X取副本(),
		X错误:          c.X错误,
	}
}
